export function jsonToFormData(json) {
  const formData = new FormData();
  if (typeof json === 'object') {
    const keys = Object.keys(json);
    keys.forEach((key) => {
      formData.append(key, json[key]);
    });
  }
  return formData;
}
export function jsonToStr(json) {
  const str = [];
  if (typeof json === 'object') {
    const keys = Object.keys(json);
    const last = keys.length - 1;
    keys.forEach((key, index) => {
      if (index === 0) {
        str.push('?');
      }
      str.push(`${key}=${json[key]}`);
      if (index !== last) {
        str.push('&');
      }
    });
  }
  return str.join('');
}
